[mirrors]
http://www.lua.org/ftp/lua-5.2.3.tar.gz

[main]
filesize=251195
sha512=264bb7c8db2f190ef0ca38584ec81999ab588f54e03119c5214c40bb8925b0eb407fac483a03e40cc8a220f6748ddff7d3a7392da3803418276b0d263b866449

[deps]
readline

[build]
sed -i "s@#define LUA_ROOT\t"'"/usr/local/"@#define LUA_ROOT "/"@' src/luaconf.h
sed -i 's@INSTALL_TOP= /usr/local@INSTALL_TOP='"$butch_install_dir""$butch_prefix"'@' Makefile

make CC="$CC" -j$MAKE_THREADS MYCFLAGS="-fPIC $optcflags" MYLDFLAGS="$optldflags" linux
make INSTALL_TOP="$butch_install_dir""$butch_prefix" install
dest="$butch_install_dir""$butch_prefix"
mkdir -p "$dest"/lib/pkgconfig
for subver in 1 2 ; do
cat << EOF > "$dest"/lib/pkgconfig/lua-5.${subver}.pc
majver=5
minver=$subver
relver=0
version=\${majver}.\${minver}.\${relver}
abiver=5.$subver

prefix=$butch_prefix
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
libname=lua
includedir=\${prefix}/include

INSTALL_LMOD=\${prefix}/share/lua/\${abiver}
INSTALL_CMOD=${prefix}/lib/lua/${abiver}

Name: lua
Description: Just-in-time compiler for Lua
URL: http://luajit.org
Version: \${version}
Requires:
Libs: -L\${libdir} -l\${libname}
Libs.private: -Wl,-E -lm -ldl
Cflags: -I\${includedir}

EOF
done
